<template>
	<view>
		<view class="">
			<u-navbar title="设置"  back-icon-color="#000" title-color="#000" :border-bottom="false"></u-navbar>
		</view>
		<uni-list class="mt10" >
			<uni-list-item title="用户名" :rightText="vk.getVuex('$user.userInfo.username')" :showArrow="false"></uni-list-item>
			<uni-list-item title="个人信息" :rightText ="'编辑'" to="../myInfo/editUserinfo/editUserinfo" link="navigateTo"></uni-list-item>
			<!-- <uni-list-item title="手机号码" :rightText="tel?tel:'绑定手机'"   to="" link="navigateTo"></uni-list-item> -->
			<u-gap height="15" bg-color="#F6F6F6"></u-gap>
			<uni-list-item title="用户协议" :rightText ="''" to="../webview/webview?url=http://static-d0d1dade-d4aa-4389-a86d-0459737eb16e.bspapp.com/doc/xy.html" link="navigateTo"></uni-list-item>
			<uni-list-item title="隐私政策" :rightText ="''" to="../webview/webview?url=http://static-d0d1dade-d4aa-4389-a86d-0459737eb16e.bspapp.com/doc/yszc.html" link="navigateTo"></uni-list-item>
			<uni-list-item title="关于" :rightText ="' '" to="../about/about" link="navigateTo"></uni-list-item>
		</uni-list>
		
		<view class="bottom-back" @click="clickLogout">
			<text class="bottom-back-text">退出登录</text>
			<!-- <text class="bottom-back-text" v-else>{{$t('settings.login')}}</text> -->
		</view>
		
	</view>
</template>

<script>
	var that;		// 当前页面对象
	var vk;			// vk依赖
	export default {
		data() {
			return {
				tel:'10',
				username:'fjfdka111',
				data:{
					
				},
				// 表单请求数据
				form1:{
					
				},
				scrollTop:0,
			}
		},
		onPageScroll(e) {
			that.scrollTop = e.scrollTop;
		},
		onLoad(options = {}) {
			that = this;
			vk = that.vk;
			that.options = options;
			that.init(options);
		},
		methods: {
			init(options){
				if (!options) options = that.options;
				console.log("init: ",options);
				
			},
			async clickLogout(){
				let res = await uni.showModal({
					title:'提示',
					content:'确认退出当前登录？',
					confirmColor:'#1B975A'
					
				})
				// console.log(res)
				if(res[1].cancel){
					return
				}
				
				uni.showLoading({
					title:'正在退出'
				})
				vk.userCenter.logout({
				  success: function(data) {
				    // 退出登录成功后的逻辑
					uni.showToast({
						title:'退出成功'
					})
					
					// console.log(e.result.msg)
					setTimeout(()=>{
						uni.navigateTo({
							url:'../login/login'
						})
					},1500)
				  }
				});

				
			}
		}
	}
</script>

<style lang="scss" scoped>
.bottom-back {
		margin-top: 10px;
		width: 750rpx;
		height: 44px;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		/* #ifndef APP-NVUE */
		border: none;
		/* #endif */
		border-width: 0;
		border-radius: 0;
		background-color: #FFFFFF;
	}

	.bottom-back-text {
		font-size: 33rpx;
	}
</style>
